const ws = new WebSocket(`ws://${window.location.host}/im2`);

ws.onopen = () => {
  console.log('握手成功');
  ws.send(JSON.stringify({a: 123, b: 456}));
}

ws.onmessage = (e) => {
  console.log(e);
}

ws.onclose = () => {
  console.log('连接已断开');
}
